<?php

namespace App\Services\Payment\ShouQianBa;

use D1M\Payment\Service\ShouQianBa\POSInfoSourceInterface;
use Illuminate\Http\Request;

class POSInfoSource implements POSInfoSourceInterface
{

    private Request $request;

    /**
     * @param Request $request
     */
    public function __construct(Request $request)
    {
        $this->request = $request;
    }

    /**
     * @inheritDoc
     */
    public function getWorkstationSn()
    {
        $json = $this->request->json();
        $deviceId = $json->get('device_id');
        return substr($deviceId, 0, 8);
    }
}